<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace HyperfTest\Cases;

use Hyperf\Testing\Client;
use Hyperf\Utils\Str;
use HyperfTest\HttpTestCase;

/**
 * @internal
 * @coversNothing
 */
class UserTest extends HttpTestCase
{
    /**
     * @var Client
     */
    protected $client;

    public function __construct($name = null, array $data = [], $dataName = '')
    {
        parent::__construct($name, $data, $dataName);
        $this->client = make(Client::class);
    }

    /**
     * @test
     */
    public function canRegister()
    {
        $nickName = Str::random();
        $res = $this->client->json('/api/register', [
            'name' => $nickName,
            'nick_name' => $nickName,
            'password' => '123456',
        ]);

        $this->assertSame($nickName, $res['nick_name']);
    }
}
